home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Peter Lewis / PNL Libraries / MySpeak.p < prev    next >
Encoding:
Text File  |  1993-12-03  |  901 b   |  56 lines  |  [TEXT/PJMM]

  1. unit MySpeak;
  2.  
  3. interface
  4.  
  5.     procedure InitSpeak;
  6.     procedure FinishSpeak;
  7.     function SpeakBusy: boolean;
  8.     procedure SpeakStr (s: str255);
  9.     procedure Speak (id, index: integer);
  10.     function SpeechAvailable: boolean;
  11.  
  12. implementation
  13.  
  14.     uses
  15.         Speech;
  16.  
  17.     function SpeechAvailable: boolean;
  18.         var
  19.             v: longInt;
  20.     begin
  21.         SpeechAvailable := (Gestalt(gestaltSpeechAttr, v) = noErr) & BTST(v, gestaltSpeechMgrPresent);
  22.     end;
  23.  
  24.     function SpeakBusy: boolean;
  25.     begin
  26.         SpeakBusy := SpeechAvailable and (SpeechBusy > 0);
  27.     end;
  28.  
  29.     procedure SpeakStr (s: str255);
  30.     begin
  31.         if not SpeechAvailable | (SpeakString(s) <> noErr) then begin
  32.             SysBeep(1);
  33.         end;
  34.     end;
  35.  
  36.     procedure Speak (id, index: integer);
  37.         var
  38.             s: str255;
  39.     begin
  40.         GetIndString(s, id, index);
  41.         SpeakStr(s);
  42.     end;
  43.  
  44. {$S Init}
  45.     procedure InitSpeak;
  46.     begin
  47.     end;
  48.  
  49. {$S Term}
  50.     procedure FinishSpeak;
  51.     begin
  52.         if SpeechAvailable then
  53.             SpeakStr('');
  54.     end;
  55.  
  56. end.